<?php

namespace app\index\model;

use think\Model;

class Award extends Model
{
    protected $pk = 'awar_id';

    public function getUserAttr($value, $data){
        $phone =  Member::where('memb_id', $data['awar_uid'])->value('memb_phone');
        return substr($phone, 0, 3). '****' .substr($phone, -4, 4);
    }
    /**
    * 根据where获取相应数量的数据 
    */
    public function getAward($where, $count){
        return $this->field('awar_name, awar_uid')->where($where)->order('awar_id', 'desc')->limit($count)->select()->append(['user']);
    }
}
